<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.16"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>LibTools: H:/project/LibTools/src/socket/internal/UdpServer.cpp 源文件</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">LibTools
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.8.16 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',false,false,'search.php','搜索');
});
/* @license-end */</script>
<div id="main-nav"></div>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_9ad1227260954e346101f3844f0abb3d.html">socket</a></li><li class="navelem"><a class="el" href="dir_1865c4ce8b99f52bbeabfd52bfdd7cd3.html">internal</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">UdpServer.cpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_udp_server_8cpp.html">浏览该文件的文档.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="preprocessor">#ifdef WIN32</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="preprocessor">#   include &quot;<a class="code" href="_iocp_service_8h.html">IocpService.h</a>&quot;</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="preprocessor">#elif defined(LINUX)</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="preprocessor">#   include &quot;<a class="code" href="_epoll_service_8h.html">EpollService.h</a>&quot;</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="_udp_socket_8h.html">UdpSocket.h</a>&quot;</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="_udp_server_8h.html">UdpServer.h</a>&quot;</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor">#include &quot;../SockException.h&quot;</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#include &quot;../Timer.h&quot;</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor">#include &lt;assert.h&gt;</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160; </div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<a class="code" href="tools_8h.html#a201ce692c9dca6599e5c12d00167419b">DEF_BEG_LIBTOOLS</a></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160; </div>
<div class="line"><a name="l00014"></a><span class="lineno"><a class="line" href="class_c_udp_server.html#a1822fe02505a31d617e136515243a2a1">   14</a></span>&#160;<a class="code" href="class_c_udp_server.html#a1822fe02505a31d617e136515243a2a1">CUdpServer::CUdpServer</a>(<span class="keywordtype">bool</span> isWriteLog) :<a class="code" href="class_c_udp_base.html">CUdpBase</a>(isWriteLog)</div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;{</div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="preprocessor">#ifdef WIN32</span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;    <a class="code" href="class_c_udp_server.html#a7c2f7216c3241414dc4d76175240a42d">_service</a>.<a class="code" href="class_shared_ptr.html#a0b0a4c8396bf40f91994f729855c0a5a">Reset</a>(<span class="keyword">new</span> CIocpService(&amp;<a class="code" href="class_c_udp_server.html#a4287fe6a8d3a5fe821d4faf52fc68ebc">IoCompleteFunc</a>));</div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="preprocessor">#elif defined(LINUX)</span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;    <a class="code" href="class_c_udp_server.html#a7c2f7216c3241414dc4d76175240a42d">_service</a>.<a class="code" href="class_shared_ptr.html#a0b0a4c8396bf40f91994f729855c0a5a">Reset</a>(<span class="keyword">new</span> <a class="code" href="class_c_epoll_service.html">CEpollService</a>(&amp;<a class="code" href="class_c_udp_server.html#a4287fe6a8d3a5fe821d4faf52fc68ebc">IoCompleteFunc</a>));</div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;}</div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160; </div>
<div class="line"><a name="l00023"></a><span class="lineno"><a class="line" href="class_c_udp_server.html#a57d265889fc60581f3274d424c3325bb">   23</a></span>&#160;<a class="code" href="class_c_udp_server.html#a57d265889fc60581f3274d424c3325bb">CUdpServer::~CUdpServer</a>()</div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;{</div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160; </div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;}</div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160; </div>
<div class="line"><a name="l00028"></a><span class="lineno"><a class="line" href="class_c_udp_server.html#a5862a7fd4ea7b754552eedc19cfdaa53">   28</a></span>&#160;<a class="code" href="class_c_sock_error.html">CSockError</a> <a class="code" href="class_c_udp_server.html#a5862a7fd4ea7b754552eedc19cfdaa53">CUdpServer::Init</a>(<a class="code" href="class_c_socket.html">CSocket</a>&amp; sock, <span class="keywordtype">bool</span> isServer <span class="comment">/* = false */</span>)</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;{</div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;    <a class="code" href="class_c_sock_addr.html">CSockAddr</a> addr;</div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;    </div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;    <span class="keywordflow">if</span> (!<a class="code" href="class_c_udp_server.html#a7c2f7216c3241414dc4d76175240a42d">_service</a>-&gt;<a class="code" href="class_c_io_port_service.html#a4e27edba8096659e67f2f275eeeba984">IsInit</a>()) {</div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;        <span class="keywordflow">throw</span> <a class="code" href="class_c_sock_exception.html">CSockException</a>(<a class="code" href="class_c_sock_error.html">CSockError</a>(<a class="code" href="namespace_s_o_c_k_e_t_s_t_a_t_u_s.html#a960fa087f22eb32da3c7d0c805be7876a5a76b20cc3c857f53d6e5e7e817c8959">CSockError::UNINIT</a>).GetErrorMsg().c_str());</div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;    }</div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;    <a class="code" href="class_c_sock_error.html">CSockError</a> ec = <a class="code" href="_sock_tools_8cpp.html#a94adf0712e04454717a4327e9061bdf8">GetSockName</a>(sock, addr);</div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;    <span class="keywordflow">if</span> (ec) <span class="keywordflow">return</span> ec;</div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160; </div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;    sock.<a class="code" href="class_c_socket.html#ad08fc2df680d1fd84035f5aada97dd3a">SetService</a>(<span class="keyword">this</span>);</div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160; </div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="class_c_udp_server.html#a7c2f7216c3241414dc4d76175240a42d">_service</a>-&gt;<a class="code" href="class_c_io_port_service.html#afc1a07c4cf6e9aa6f2a00d157dfd9eed">Init</a>(sock, <span class="keyword">false</span>);</div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;}</div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160; </div>
<div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="class_c_udp_server.html#aeb69d95dd3123fd4f56d565a19fbec67">   43</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_c_udp_server.html#aeb69d95dd3123fd4f56d565a19fbec67">CUdpServer::AsyncRecvfrom</a>(<a class="code" href="class_c_udp_socket.html">CUdpSocket</a>&amp; sock, <span class="keyword">const</span> <a class="code" href="class_c_stream_iteator.html">CStreamIteator</a>&amp; buff, <a class="code" href="class_c_sock_addr.html">CSockAddr</a>* addr, <span class="keyword">const</span> <a class="code" href="class_shared_ptr.html">SharedPtr&lt;HandleBase&gt;</a>&amp; func, <span class="keywordtype">void</span>* invoker<span class="comment">/* = NullPtr*/</span>)</div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;{</div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;    <span class="keywordflow">if</span> (!<a class="code" href="class_c_udp_server.html#a7c2f7216c3241414dc4d76175240a42d">_service</a>-&gt;<a class="code" href="class_c_io_port_service.html#a4e27edba8096659e67f2f275eeeba984">IsInit</a>()) {</div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;        <span class="keywordflow">throw</span> <a class="code" href="class_c_sock_exception.html">CSockException</a>(<a class="code" href="class_c_sock_error.html">CSockError</a>(<a class="code" href="namespace_s_o_c_k_e_t_s_t_a_t_u_s.html#a960fa087f22eb32da3c7d0c805be7876a5a76b20cc3c857f53d6e5e7e817c8959">CSockError::UNINIT</a>).GetErrorMsg().c_str());</div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;    }</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;    <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;        <a class="code" href="class_c_udp_server.html#a7c2f7216c3241414dc4d76175240a42d">_service</a>-&gt;<a class="code" href="class_c_io_port_service.html#a258367c891c1b3f4208c7b41e95b864d">DeliveryRecv</a>(sock, (<span class="keywordtype">char</span>*)buff.<a class="code" href="class_c_stream_iteator.html#a0099f615b4deffd3273c9c4d7cae4a91">cbegin</a>(), (<span class="keywordtype">char</span>*)buff.<a class="code" href="class_c_stream_iteator.html#abd398f0c306bb0d8090328abdf29580a">cend</a>(), addr, func, invoker);</div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;    }</div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;}</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160; </div>
<div class="line"><a name="l00053"></a><span class="lineno"><a class="line" href="class_c_udp_server.html#a304307c8af55a434f960791a3c038d23">   53</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_c_udp_server.html#a304307c8af55a434f960791a3c038d23">CUdpServer::AsyncSendTo</a>(<a class="code" href="class_c_udp_socket.html">CUdpSocket</a>&amp; sock, <span class="keyword">const</span> <a class="code" href="class_c_stream_iteator.html">CStreamIteator</a>&amp; buff, <a class="code" href="class_c_sock_addr.html">CSockAddr</a>* addr, <span class="keyword">const</span> <a class="code" href="class_shared_ptr.html">SharedPtr&lt;HandleBase&gt;</a>&amp; func, <span class="keywordtype">void</span>* invoker<span class="comment">/* = NullPtr*/</span>)</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;{</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;    <span class="keywordflow">if</span> (!<a class="code" href="class_c_udp_server.html#a7c2f7216c3241414dc4d76175240a42d">_service</a>-&gt;<a class="code" href="class_c_io_port_service.html#a4e27edba8096659e67f2f275eeeba984">IsInit</a>()) {</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;        <span class="keywordflow">throw</span> <a class="code" href="class_c_sock_exception.html">CSockException</a>(<a class="code" href="class_c_sock_error.html">CSockError</a>(<a class="code" href="namespace_s_o_c_k_e_t_s_t_a_t_u_s.html#a960fa087f22eb32da3c7d0c805be7876a5a76b20cc3c857f53d6e5e7e817c8959">CSockError::UNINIT</a>).GetErrorMsg().c_str());</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;    }</div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;    <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;        <a class="code" href="class_c_udp_server.html#a7c2f7216c3241414dc4d76175240a42d">_service</a>-&gt;<a class="code" href="class_c_io_port_service.html#a61ce383d1dc8faf0f821237e4cc438cf">DeliveryWrite</a>(sock, (<span class="keywordtype">char</span>*)buff.<a class="code" href="class_c_stream_iteator.html#a0099f615b4deffd3273c9c4d7cae4a91">cbegin</a>(), buff.<a class="code" href="class_c_stream_iteator.html#abd398f0c306bb0d8090328abdf29580a">cend</a>(), addr, func, invoker);</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;    }</div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;}</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160; </div>
<div class="line"><a name="l00063"></a><span class="lineno"><a class="line" href="class_c_udp_server.html#a57d65bbcd1d3593a1c82ac3765c67ca3">   63</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_c_udp_server.html#a57d65bbcd1d3593a1c82ac3765c67ca3">CUdpServer::Post</a>(<span class="keyword">const</span> <a class="code" href="class_shared_ptr.html">SharedPtr&lt;HandleBase&gt;</a>&amp; func, <span class="keywordtype">void</span>* invoker<span class="comment">/* = NullPtr*/</span>)</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;{</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;    <span class="keywordflow">if</span> (!<a class="code" href="class_c_udp_server.html#a7c2f7216c3241414dc4d76175240a42d">_service</a>-&gt;<a class="code" href="class_c_io_port_service.html#a4e27edba8096659e67f2f275eeeba984">IsInit</a>()) {</div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;        <span class="keywordflow">throw</span> <a class="code" href="class_c_sock_exception.html">CSockException</a>(<a class="code" href="class_c_sock_error.html">CSockError</a>(<a class="code" href="namespace_s_o_c_k_e_t_s_t_a_t_u_s.html#a960fa087f22eb32da3c7d0c805be7876a5a76b20cc3c857f53d6e5e7e817c8959">CSockError::UNINIT</a>).GetErrorMsg().c_str());</div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;    }</div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;    <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;        <a class="code" href="class_c_udp_server.html#a7c2f7216c3241414dc4d76175240a42d">_service</a>-&gt;<a class="code" href="class_c_io_port_service.html#a2b82286514aa89ecd2a7470047c4845e">Post</a>(func, invoker);</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;    }</div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;}</div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160; </div>
<div class="line"><a name="l00073"></a><span class="lineno"><a class="line" href="class_c_udp_server.html#a094ecc90a9e5cd326a58928bf48ce08c">   73</a></span>&#160;<span class="keywordtype">bool</span> <a class="code" href="class_c_udp_server.html#a094ecc90a9e5cd326a58928bf48ce08c">CUdpServer::Run</a>()</div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;{</div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;    <span class="keywordflow">if</span> (!<a class="code" href="class_c_udp_server.html#a7c2f7216c3241414dc4d76175240a42d">_service</a>-&gt;<a class="code" href="class_c_io_port_service.html#a4e27edba8096659e67f2f275eeeba984">IsInit</a>()) {</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;    }</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160; </div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="class_c_udp_server.html#a7c2f7216c3241414dc4d76175240a42d">_service</a>-&gt;<a class="code" href="class_c_io_port_service.html#a56a9ae4bb89bd85e21ae5507e3c6b093">Run</a>();</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;}</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160; </div>
<div class="line"><a name="l00082"></a><span class="lineno"><a class="line" href="class_c_udp_server.html#aed8baba7d9895b6895d9624ee8cb1bf4">   82</a></span>&#160;<span class="keywordtype">bool</span> <a class="code" href="class_c_udp_server.html#aed8baba7d9895b6895d9624ee8cb1bf4">CUdpServer::Run_One</a>()</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;{</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;    <span class="keywordflow">if</span> (!<a class="code" href="class_c_udp_server.html#a7c2f7216c3241414dc4d76175240a42d">_service</a>-&gt;<a class="code" href="class_c_io_port_service.html#a4e27edba8096659e67f2f275eeeba984">IsInit</a>()) {</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;    }</div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160; </div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="class_c_udp_server.html#a7c2f7216c3241414dc4d76175240a42d">_service</a>-&gt;<a class="code" href="class_c_io_port_service.html#a8eb92d255bda145631e1dc57e42d3dba">Run_One</a>();</div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;}</div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160; </div>
<div class="line"><a name="l00091"></a><span class="lineno"><a class="line" href="class_c_udp_server.html#a926f304c91aa6e0d66e7fe7f3189f5e6">   91</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_c_udp_server.html#a926f304c91aa6e0d66e7fe7f3189f5e6">CUdpServer::NotifyStop</a>()</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;{</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;    <a class="code" href="class_c_udp_server.html#a7c2f7216c3241414dc4d76175240a42d">_service</a>-&gt;<a class="code" href="class_c_io_port_service.html#a88ce9281be3952a469f8c3b6bf0f9d5b">NotifyStop</a>();</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;}</div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160; </div>
<div class="line"><a name="l00096"></a><span class="lineno"><a class="line" href="class_c_udp_server.html#a8963defe56982aaff79417667d23da96">   96</a></span>&#160;<span class="keywordtype">bool</span> <a class="code" href="class_c_udp_server.html#a8963defe56982aaff79417667d23da96">CUdpServer::IsStop</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;<span class="keyword"></span>{</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160; </div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="class_c_udp_server.html#a7c2f7216c3241414dc4d76175240a42d">_service</a>-&gt;<a class="code" href="class_c_io_port_service.html#a87b609526def283ffb20cc4b4c082473">IsStop</a>();</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;}</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160; </div>
<div class="line"><a name="l00102"></a><span class="lineno"><a class="line" href="class_c_udp_server.html#a2242ee6ccbb71fa768ba191c8a61f9a2">  102</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_c_udp_server.html#a2242ee6ccbb71fa768ba191c8a61f9a2">CUdpServer::WaitServerStop</a>()</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;{</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;    <a class="code" href="class_c_udp_server.html#a7c2f7216c3241414dc4d76175240a42d">_service</a>-&gt;<a class="code" href="class_c_io_port_service.html#a88ce9281be3952a469f8c3b6bf0f9d5b">NotifyStop</a>();</div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;    <a class="code" href="class_c_udp_server.html#a7c2f7216c3241414dc4d76175240a42d">_service</a>-&gt;<a class="code" href="class_c_io_port_service.html#ae247b9ad53c577481a6a17713e6a0685">Shutdown</a>();</div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;}</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160; </div>
<div class="line"><a name="l00109"></a><span class="lineno"><a class="line" href="class_c_udp_server.html#a2ebcef4f1740e51441e89af47f89d2e5">  109</a></span>&#160;<a class="code" href="class_c_io_port_service.html">CIoPortService</a>* <a class="code" href="class_c_udp_server.html#a2ebcef4f1740e51441e89af47f89d2e5">CUdpServer::GetIoPortService</a>()</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;{</div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="class_c_udp_server.html#a7c2f7216c3241414dc4d76175240a42d">_service</a>.<a class="code" href="class_shared_ptr.html#a0f15d2d3d2834b0667791f3abfd9e0d7">Get</a>();</div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;}</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160; </div>
<div class="line"><a name="l00114"></a><span class="lineno"><a class="line" href="class_c_udp_server.html#a18883092a65b385806b3cb3552f56f38">  114</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_c_udp_server.html#a18883092a65b385806b3cb3552f56f38">CUdpServer::DelTimer</a>(<a class="code" href="class_c_timer_base.html">CTimerBase</a>&amp; timer)</div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;{</div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;    <span class="keywordflow">if</span> (!<a class="code" href="class_c_udp_server.html#a7c2f7216c3241414dc4d76175240a42d">_service</a>-&gt;<a class="code" href="class_c_io_port_service.html#a4e27edba8096659e67f2f275eeeba984">IsInit</a>()) {</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;        <span class="keywordflow">throw</span> <a class="code" href="class_c_sock_exception.html">CSockException</a>(<a class="code" href="class_c_sock_error.html">CSockError</a>(<a class="code" href="namespace_s_o_c_k_e_t_s_t_a_t_u_s.html#a960fa087f22eb32da3c7d0c805be7876a5a76b20cc3c857f53d6e5e7e817c8959">CSockError::UNINIT</a>).GetErrorMsg().c_str());</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;    }</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;    <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;        <a class="code" href="class_c_udp_server.html#a7c2f7216c3241414dc4d76175240a42d">_service</a>-&gt;<a class="code" href="class_c_io_port_service.html#a6a56a2a5a014ee11d4696eac5096d198">DelTimer</a>(*timer.<a class="code" href="class_c_timer_base.html#a1ea13f83b73eb54062006d563a5c2f85">GetTimerInfo</a>());</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;    }</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;}</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160; </div>
<div class="line"><a name="l00124"></a><span class="lineno"><a class="line" href="class_c_udp_server.html#a007ed280c7fb7066bc957425e7dc746b">  124</a></span>&#160;<span class="keywordtype">bool</span> <a class="code" href="class_c_udp_server.html#a007ed280c7fb7066bc957425e7dc746b">CUdpServer::UpdateTimer</a>(<a class="code" href="class_c_timer_base.html">CTimerBase</a>&amp; timer)</div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;{</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;    <span class="keywordflow">if</span> (!<a class="code" href="class_c_udp_server.html#a7c2f7216c3241414dc4d76175240a42d">_service</a>-&gt;<a class="code" href="class_c_io_port_service.html#a4e27edba8096659e67f2f275eeeba984">IsInit</a>()) {</div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;        <span class="keywordflow">throw</span> <a class="code" href="class_c_sock_exception.html">CSockException</a>(<a class="code" href="class_c_sock_error.html">CSockError</a>(<a class="code" href="namespace_s_o_c_k_e_t_s_t_a_t_u_s.html#a960fa087f22eb32da3c7d0c805be7876a5a76b20cc3c857f53d6e5e7e817c8959">CSockError::UNINIT</a>).GetErrorMsg().c_str());</div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;    }</div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160; </div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="class_c_udp_server.html#a7c2f7216c3241414dc4d76175240a42d">_service</a>-&gt;<a class="code" href="class_c_io_port_service.html#ac30315805f5476c9e5ff36f3fa542485">UpdateTimer</a>(*timer.<a class="code" href="class_c_timer_base.html#a1ea13f83b73eb54062006d563a5c2f85">GetTimerInfo</a>());</div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;}</div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160; </div>
<div class="line"><a name="l00133"></a><span class="lineno"><a class="line" href="class_c_udp_server.html#aeb3e2cc49ab20aeaf396c40e28f58627">  133</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_c_udp_server.html#aeb3e2cc49ab20aeaf396c40e28f58627">CUdpServer::SetTimer</a>(<a class="code" href="class_c_timer_base.html">CTimerBase</a>&amp; timer)</div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;{</div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;    <span class="keywordflow">if</span> (!<a class="code" href="class_c_udp_server.html#a7c2f7216c3241414dc4d76175240a42d">_service</a>-&gt;<a class="code" href="class_c_io_port_service.html#a4e27edba8096659e67f2f275eeeba984">IsInit</a>()) {</div>
<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;        <span class="keywordflow">throw</span> <a class="code" href="class_c_sock_exception.html">CSockException</a>(<a class="code" href="class_c_sock_error.html">CSockError</a>(<a class="code" href="namespace_s_o_c_k_e_t_s_t_a_t_u_s.html#a960fa087f22eb32da3c7d0c805be7876a5a76b20cc3c857f53d6e5e7e817c8959">CSockError::UNINIT</a>).GetErrorMsg().c_str());</div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;    }</div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;    <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;        <a class="code" href="class_c_udp_server.html#a7c2f7216c3241414dc4d76175240a42d">_service</a>-&gt;<a class="code" href="class_c_io_port_service.html#a5ffa1d9379ae7595d2febd119f42a738">SetTimer</a>(*timer.<a class="code" href="class_c_timer_base.html#a1ea13f83b73eb54062006d563a5c2f85">GetTimerInfo</a>());</div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;    }</div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;}</div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160; </div>
<div class="line"><a name="l00143"></a><span class="lineno"><a class="line" href="class_c_udp_server.html#a4287fe6a8d3a5fe821d4faf52fc68ebc">  143</a></span>&#160;<a class="code" href="tools_8h.html#a798af1e30bc65f319c1a246cecf59e39">DWORD</a> <a class="code" href="class_c_udp_server.html#a4287fe6a8d3a5fe821d4faf52fc68ebc">CUdpServer::IoCompleteFunc</a>(<a class="code" href="struct_o_v_e_r_l_a_p_p_e_d___e_x.html">OVERLAPPED_EX</a>* oved)</div>
<div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;{</div>
<div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;    <a class="code" href="tools_8h.html#a798af1e30bc65f319c1a246cecf59e39">DWORD</a> dwRet = 0;</div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;    <a class="code" href="class_shared_ptr.html">SharedPtr&lt;HandleBase&gt;</a> handle;</div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;    handle.<a class="code" href="class_shared_ptr.html#a4d01af086ba301328e14f279a7ab400a">Swap</a>(oved-&gt;<a class="code" href="struct_o_v_e_r_l_a_p_p_e_d___e_x.html#a2696e48028b12aa65b271ec208c5483c">handle</a>);</div>
<div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;    <span class="keywordflow">if</span> (oved-&gt;<a class="code" href="struct_o_v_e_r_l_a_p_p_e_d___e_x.html#a614e5742d57e4905fdf46b8727486b5e">sockStatus</a> == <a class="code" href="namespace_s_o_c_k_e_t_s_t_a_t_u_s.html#a960fa087f22eb32da3c7d0c805be7876a8e36da283b8c83b61bab630b9b858724">SOCKETSTATUS::RECVED</a>)</div>
<div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;    {</div>
<div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;        dwRet = (*handle)(oved-&gt;<a class="code" href="struct_o_v_e_r_l_a_p_p_e_d___e_x.html#a3da45429c23fe76e84378d5dcfd24daa">wsaPtr</a>.<a class="code" href="struct___w_s_a_b_u_f.html#a018f049fe75c6f822a1765f16fdcb1f6">buf</a>, oved-&gt;<a class="code" href="struct_o_v_e_r_l_a_p_p_e_d___e_x.html#a46009f6f99e2e4e9e648f51ad55927ef">dwRead</a>, oved-&gt;<a class="code" href="struct_o_v_e_r_l_a_p_p_e_d___e_x.html#aa4b473bf1be397a9e437a397f907e69d">addrbuf</a>, oved-&gt;<a class="code" href="struct_o_v_e_r_l_a_p_p_e_d___e_x.html#a29eca265ddf9e8858e7360a27004866b">sockError</a>, oved-&gt;<a class="code" href="struct_o_v_e_r_l_a_p_p_e_d___e_x.html#af6cda33264504094d59752d5725eb8e6">invoker</a>);</div>
<div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;    }</div>
<div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;    <span class="keywordflow">else</span> <span class="keywordflow">if</span> (oved-&gt;<a class="code" href="struct_o_v_e_r_l_a_p_p_e_d___e_x.html#a614e5742d57e4905fdf46b8727486b5e">sockStatus</a> == <a class="code" href="namespace_s_o_c_k_e_t_s_t_a_t_u_s.html#a960fa087f22eb32da3c7d0c805be7876a52566ca153bf6bcb661b1e8e606d3b5b">SOCKETSTATUS::SENDED</a>)</div>
<div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;    {</div>
<div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;        dwRet = (*handle)(oved-&gt;<a class="code" href="struct_o_v_e_r_l_a_p_p_e_d___e_x.html#a3da45429c23fe76e84378d5dcfd24daa">wsaPtr</a>.<a class="code" href="struct___w_s_a_b_u_f.html#a018f049fe75c6f822a1765f16fdcb1f6">buf</a>, oved-&gt;<a class="code" href="struct_o_v_e_r_l_a_p_p_e_d___e_x.html#ae3a09cbbd58ac06dfd92673e3e7130fd">dwWrite</a>, oved-&gt;<a class="code" href="struct_o_v_e_r_l_a_p_p_e_d___e_x.html#aa4b473bf1be397a9e437a397f907e69d">addrbuf</a>, oved-&gt;<a class="code" href="struct_o_v_e_r_l_a_p_p_e_d___e_x.html#a29eca265ddf9e8858e7360a27004866b">sockError</a>, oved-&gt;<a class="code" href="struct_o_v_e_r_l_a_p_p_e_d___e_x.html#af6cda33264504094d59752d5725eb8e6">invoker</a>);</div>
<div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;    }</div>
<div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;    <span class="keywordflow">else</span> <span class="keywordflow">if</span> (oved-&gt;<a class="code" href="struct_o_v_e_r_l_a_p_p_e_d___e_x.html#a614e5742d57e4905fdf46b8727486b5e">sockStatus</a> == <a class="code" href="namespace_s_o_c_k_e_t_s_t_a_t_u_s.html#a960fa087f22eb32da3c7d0c805be7876acbc6a92d2f6de3cda399fb0de0ffdd98">SOCKETSTATUS::POST</a>)</div>
<div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;    {</div>
<div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;        dwRet = (*handle)(oved-&gt;<a class="code" href="struct_o_v_e_r_l_a_p_p_e_d___e_x.html#af6cda33264504094d59752d5725eb8e6">invoker</a>);</div>
<div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;    }</div>
<div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;    <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;        assert(dwRet);</div>
<div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;    }</div>
<div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160; </div>
<div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;    <span class="keywordflow">return</span> dwRet;</div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;}</div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160; </div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;<a class="code" href="tools_8h.html#ac909db71799bb22cb7d636a34cd785e4">DEF_END_LIBTOOLS</a></div>
</div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="aclass_c_io_port_service_html_a56a9ae4bb89bd85e21ae5507e3c6b093"><div class="ttname"><a href="class_c_io_port_service.html#a56a9ae4bb89bd85e21ae5507e3c6b093">CIoPortService::Run</a></div><div class="ttdeci">virtual bool Run()=0</div><div class="ttdoc">运行服务</div></div>
<div class="ttc" id="aclass_c_io_port_service_html_a61ce383d1dc8faf0f821237e4cc438cf"><div class="ttname"><a href="class_c_io_port_service.html#a61ce383d1dc8faf0f821237e4cc438cf">CIoPortService::DeliveryWrite</a></div><div class="ttdeci">virtual void DeliveryWrite(CSocket &amp;sock, const char *first, const char *end, CSockAddr *addr, const SharedPtr&lt; HandleBase &gt; &amp;func, void *invoker=NullPtr)=0</div><div class="ttdoc">投递一个写请求</div></div>
<div class="ttc" id="aclass_c_sock_error_html"><div class="ttname"><a href="class_c_sock_error.html">CSockError</a></div><div class="ttdoc">套接字错误信息类</div><div class="ttdef"><b>Definition:</b> <a href="_sock_error_8h_source.html#l00013">SockError.h:13</a></div></div>
<div class="ttc" id="aclass_c_timer_base_html_a1ea13f83b73eb54062006d563a5c2f85"><div class="ttname"><a href="class_c_timer_base.html#a1ea13f83b73eb54062006d563a5c2f85">CTimerBase::GetTimerInfo</a></div><div class="ttdeci">TimeoutInfo * GetTimerInfo()</div><div class="ttdoc">获取底层时间信息</div><div class="ttdef"><b>Definition:</b> <a href="_timer_8cpp_source.html#l00091">Timer.cpp:91</a></div></div>
<div class="ttc" id="astruct_o_v_e_r_l_a_p_p_e_d___e_x_html_aa4b473bf1be397a9e437a397f907e69d"><div class="ttname"><a href="struct_o_v_e_r_l_a_p_p_e_d___e_x.html#aa4b473bf1be397a9e437a397f907e69d">OVERLAPPED_EX::addrbuf</a></div><div class="ttdeci">CSockAddr * addrbuf</div><div class="ttdoc">地址信息</div><div class="ttdef"><b>Definition:</b> <a href="_sock_data_8h_source.html#l00073">SockData.h:73</a></div></div>
<div class="ttc" id="aclass_c_stream_iteator_html"><div class="ttname"><a href="class_c_stream_iteator.html">CStreamIteator</a></div><div class="ttdef"><b>Definition:</b> <a href="_stream_byte_8h_source.html#l00011">StreamByte.h:11</a></div></div>
<div class="ttc" id="aclass_c_udp_server_html_a5862a7fd4ea7b754552eedc19cfdaa53"><div class="ttname"><a href="class_c_udp_server.html#a5862a7fd4ea7b754552eedc19cfdaa53">CUdpServer::Init</a></div><div class="ttdeci">virtual CSockError Init(CSocket &amp;sock, bool isServer)</div><div class="ttdoc">将sock与服务类绑定，一个socket只能绑定一个udp服务类</div><div class="ttdef"><b>Definition:</b> <a href="_udp_server_8cpp_source.html#l00028">UdpServer.cpp:28</a></div></div>
<div class="ttc" id="anamespace_s_o_c_k_e_t_s_t_a_t_u_s_html_a960fa087f22eb32da3c7d0c805be7876a52566ca153bf6bcb661b1e8e606d3b5b"><div class="ttname"><a href="namespace_s_o_c_k_e_t_s_t_a_t_u_s.html#a960fa087f22eb32da3c7d0c805be7876a52566ca153bf6bcb661b1e8e606d3b5b">SOCKETSTATUS::SENDED</a></div><div class="ttdoc">发送完成</div><div class="ttdef"><b>Definition:</b> <a href="_socket_def_8h_source.html#l00094">SocketDef.h:94</a></div></div>
<div class="ttc" id="aclass_c_udp_server_html_a57d265889fc60581f3274d424c3325bb"><div class="ttname"><a href="class_c_udp_server.html#a57d265889fc60581f3274d424c3325bb">CUdpServer::~CUdpServer</a></div><div class="ttdeci">virtual ~CUdpServer()</div><div class="ttdef"><b>Definition:</b> <a href="_udp_server_8cpp_source.html#l00023">UdpServer.cpp:23</a></div></div>
<div class="ttc" id="astruct_o_v_e_r_l_a_p_p_e_d___e_x_html_a46009f6f99e2e4e9e648f51ad55927ef"><div class="ttname"><a href="struct_o_v_e_r_l_a_p_p_e_d___e_x.html#a46009f6f99e2e4e9e648f51ad55927ef">OVERLAPPED_EX::dwRead</a></div><div class="ttdeci">DWORD dwRead</div><div class="ttdoc">当前读取的字节数</div><div class="ttdef"><b>Definition:</b> <a href="_sock_data_8h_source.html#l00070">SockData.h:70</a></div></div>
<div class="ttc" id="aclass_shared_ptr_html"><div class="ttname"><a href="class_shared_ptr.html">SharedPtr&lt; HandleBase &gt;</a></div></div>
<div class="ttc" id="aclass_shared_ptr_html_a0f15d2d3d2834b0667791f3abfd9e0d7"><div class="ttname"><a href="class_shared_ptr.html#a0f15d2d3d2834b0667791f3abfd9e0d7">SharedPtr::Get</a></div><div class="ttdeci">Ty * Get()</div><div class="ttdef"><b>Definition:</b> <a href="_shared_ptr_8h_source.html#l00202">SharedPtr.h:202</a></div></div>
<div class="ttc" id="astruct_o_v_e_r_l_a_p_p_e_d___e_x_html_a2696e48028b12aa65b271ec208c5483c"><div class="ttname"><a href="struct_o_v_e_r_l_a_p_p_e_d___e_x.html#a2696e48028b12aa65b271ec208c5483c">OVERLAPPED_EX::handle</a></div><div class="ttdeci">SharedPtr&lt; HandleBase &gt; handle</div><div class="ttdoc">用户完成回调函数</div><div class="ttdef"><b>Definition:</b> <a href="_sock_data_8h_source.html#l00068">SockData.h:68</a></div></div>
<div class="ttc" id="aclass_c_udp_server_html_a304307c8af55a434f960791a3c038d23"><div class="ttname"><a href="class_c_udp_server.html#a304307c8af55a434f960791a3c038d23">CUdpServer::AsyncSendTo</a></div><div class="ttdeci">virtual void AsyncSendTo(CUdpSocket &amp;sock, const CStreamIteator &amp;buff, CSockAddr *addr, const SharedPtr&lt; HandleBase &gt; &amp;func, void *invoker=NullPtr)</div><div class="ttdoc">投递一个写请求</div><div class="ttdef"><b>Definition:</b> <a href="_udp_server_8cpp_source.html#l00053">UdpServer.cpp:53</a></div></div>
<div class="ttc" id="a_udp_socket_8h_html"><div class="ttname"><a href="_udp_socket_8h.html">UdpSocket.h</a></div></div>
<div class="ttc" id="aclass_c_io_port_service_html_a8eb92d255bda145631e1dc57e42d3dba"><div class="ttname"><a href="class_c_io_port_service.html#a8eb92d255bda145631e1dc57e42d3dba">CIoPortService::Run_One</a></div><div class="ttdeci">virtual bool Run_One()=0</div><div class="ttdoc">运行一次服务</div></div>
<div class="ttc" id="aclass_c_sock_addr_html"><div class="ttname"><a href="class_c_sock_addr.html">CSockAddr</a></div><div class="ttdoc">协议地址结构体</div><div class="ttdef"><b>Definition:</b> <a href="_sock_tools_8h_source.html#l00043">SockTools.h:43</a></div></div>
<div class="ttc" id="aclass_c_udp_server_html_a007ed280c7fb7066bc957425e7dc746b"><div class="ttname"><a href="class_c_udp_server.html#a007ed280c7fb7066bc957425e7dc746b">CUdpServer::UpdateTimer</a></div><div class="ttdeci">virtual bool UpdateTimer(CTimerBase &amp;timer)</div><div class="ttdef"><b>Definition:</b> <a href="_udp_server_8cpp_source.html#l00124">UdpServer.cpp:124</a></div></div>
<div class="ttc" id="atools_8h_html_a201ce692c9dca6599e5c12d00167419b"><div class="ttname"><a href="tools_8h.html#a201ce692c9dca6599e5c12d00167419b">DEF_BEG_LIBTOOLS</a></div><div class="ttdeci">#define DEF_BEG_LIBTOOLS</div><div class="ttdef"><b>Definition:</b> <a href="tools_8h_source.html#l00036">tools.h:36</a></div></div>
<div class="ttc" id="astruct_o_v_e_r_l_a_p_p_e_d___e_x_html_af6cda33264504094d59752d5725eb8e6"><div class="ttname"><a href="struct_o_v_e_r_l_a_p_p_e_d___e_x.html#af6cda33264504094d59752d5725eb8e6">OVERLAPPED_EX::invoker</a></div><div class="ttdeci">void * invoker</div><div class="ttdoc">用户数据</div><div class="ttdef"><b>Definition:</b> <a href="_sock_data_8h_source.html#l00076">SockData.h:76</a></div></div>
<div class="ttc" id="aclass_c_io_port_service_html_a6a56a2a5a014ee11d4696eac5096d198"><div class="ttname"><a href="class_c_io_port_service.html#a6a56a2a5a014ee11d4696eac5096d198">CIoPortService::DelTimer</a></div><div class="ttdeci">virtual void DelTimer(TimerInfo &amp;tinfo)=0</div><div class="ttdoc">删除定时器</div></div>
<div class="ttc" id="aclass_c_udp_server_html_a2ebcef4f1740e51441e89af47f89d2e5"><div class="ttname"><a href="class_c_udp_server.html#a2ebcef4f1740e51441e89af47f89d2e5">CUdpServer::GetIoPortService</a></div><div class="ttdeci">virtual CIoPortService * GetIoPortService()</div><div class="ttdoc">获取底层服务类</div><div class="ttdef"><b>Definition:</b> <a href="_udp_server_8cpp_source.html#l00109">UdpServer.cpp:109</a></div></div>
<div class="ttc" id="a_sock_tools_8cpp_html_a94adf0712e04454717a4327e9061bdf8"><div class="ttname"><a href="_sock_tools_8cpp.html#a94adf0712e04454717a4327e9061bdf8">GetSockName</a></div><div class="ttdeci">CSockError GetSockName(const CSocket &amp;sock, CSockAddr &amp;addr)</div><div class="ttdoc">获取套接口本地名字</div><div class="ttdef"><b>Definition:</b> <a href="_sock_tools_8cpp_source.html#l00077">SockTools.cpp:77</a></div></div>
<div class="ttc" id="aclass_c_udp_socket_html"><div class="ttname"><a href="class_c_udp_socket.html">CUdpSocket</a></div><div class="ttdoc">udp套接口</div><div class="ttdef"><b>Definition:</b> <a href="_udp_socket_8h_source.html#l00010">UdpSocket.h:10</a></div></div>
<div class="ttc" id="aclass_c_io_port_service_html_a258367c891c1b3f4208c7b41e95b864d"><div class="ttname"><a href="class_c_io_port_service.html#a258367c891c1b3f4208c7b41e95b864d">CIoPortService::DeliveryRecv</a></div><div class="ttdeci">virtual void DeliveryRecv(CSocket &amp;sock, char *first, char *end, CSockAddr *addr, const SharedPtr&lt; HandleBase &gt; &amp;func, void *invoker=NullPtr)=0</div><div class="ttdoc">投递一个接收请求</div></div>
<div class="ttc" id="aclass_c_io_port_service_html_ac30315805f5476c9e5ff36f3fa542485"><div class="ttname"><a href="class_c_io_port_service.html#ac30315805f5476c9e5ff36f3fa542485">CIoPortService::UpdateTimer</a></div><div class="ttdeci">virtual bool UpdateTimer(TimerInfo &amp;tinfo)=0</div><div class="ttdoc">更新定时器</div></div>
<div class="ttc" id="anamespace_s_o_c_k_e_t_s_t_a_t_u_s_html_a960fa087f22eb32da3c7d0c805be7876a8e36da283b8c83b61bab630b9b858724"><div class="ttname"><a href="namespace_s_o_c_k_e_t_s_t_a_t_u_s.html#a960fa087f22eb32da3c7d0c805be7876a8e36da283b8c83b61bab630b9b858724">SOCKETSTATUS::RECVED</a></div><div class="ttdoc">接收完成</div><div class="ttdef"><b>Definition:</b> <a href="_socket_def_8h_source.html#l00098">SocketDef.h:98</a></div></div>
<div class="ttc" id="aclass_shared_ptr_html_a4d01af086ba301328e14f279a7ab400a"><div class="ttname"><a href="class_shared_ptr.html#a4d01af086ba301328e14f279a7ab400a">SharedPtr::Swap</a></div><div class="ttdeci">void Swap(SharedPtr&lt; Ty &gt; &amp;ptr)</div><div class="ttdef"><b>Definition:</b> <a href="_shared_ptr_8h_source.html#l00245">SharedPtr.h:245</a></div></div>
<div class="ttc" id="aclass_c_udp_server_html_a18883092a65b385806b3cb3552f56f38"><div class="ttname"><a href="class_c_udp_server.html#a18883092a65b385806b3cb3552f56f38">CUdpServer::DelTimer</a></div><div class="ttdeci">virtual void DelTimer(CTimerBase &amp;timer)</div><div class="ttdef"><b>Definition:</b> <a href="_udp_server_8cpp_source.html#l00114">UdpServer.cpp:114</a></div></div>
<div class="ttc" id="aclass_c_udp_server_html_a8963defe56982aaff79417667d23da96"><div class="ttname"><a href="class_c_udp_server.html#a8963defe56982aaff79417667d23da96">CUdpServer::IsStop</a></div><div class="ttdeci">virtual bool IsStop() const</div><div class="ttdoc">服务是否停止</div><div class="ttdef"><b>Definition:</b> <a href="_udp_server_8cpp_source.html#l00096">UdpServer.cpp:96</a></div></div>
<div class="ttc" id="aclass_c_socket_html"><div class="ttname"><a href="class_c_socket.html">CSocket</a></div><div class="ttdoc">套接口类</div><div class="ttdef"><b>Definition:</b> <a href="_socket_8h_source.html#l00030">Socket.h:30</a></div></div>
<div class="ttc" id="aclass_c_epoll_service_html"><div class="ttname"><a href="class_c_epoll_service.html">CEpollService</a></div><div class="ttdef"><b>Definition:</b> <a href="_epoll_service_8h_source.html#l00023">EpollService.h:23</a></div></div>
<div class="ttc" id="a_iocp_service_8h_html"><div class="ttname"><a href="_iocp_service_8h.html">IocpService.h</a></div></div>
<div class="ttc" id="astruct_o_v_e_r_l_a_p_p_e_d___e_x_html_ae3a09cbbd58ac06dfd92673e3e7130fd"><div class="ttname"><a href="struct_o_v_e_r_l_a_p_p_e_d___e_x.html#ae3a09cbbd58ac06dfd92673e3e7130fd">OVERLAPPED_EX::dwWrite</a></div><div class="ttdeci">DWORD dwWrite</div><div class="ttdoc">当前写入的字节数</div><div class="ttdef"><b>Definition:</b> <a href="_sock_data_8h_source.html#l00071">SockData.h:71</a></div></div>
<div class="ttc" id="astruct_o_v_e_r_l_a_p_p_e_d___e_x_html_a3da45429c23fe76e84378d5dcfd24daa"><div class="ttname"><a href="struct_o_v_e_r_l_a_p_p_e_d___e_x.html#a3da45429c23fe76e84378d5dcfd24daa">OVERLAPPED_EX::wsaPtr</a></div><div class="ttdeci">WSABUF wsaPtr</div><div class="ttdoc">发送或接受缓存区</div><div class="ttdef"><b>Definition:</b> <a href="_sock_data_8h_source.html#l00072">SockData.h:72</a></div></div>
<div class="ttc" id="aclass_c_timer_base_html"><div class="ttname"><a href="class_c_timer_base.html">CTimerBase</a></div><div class="ttdoc">定时器</div><div class="ttdef"><b>Definition:</b> <a href="_timer_8h_source.html#l00017">Timer.h:17</a></div></div>
<div class="ttc" id="aclass_c_socket_html_ad08fc2df680d1fd84035f5aada97dd3a"><div class="ttname"><a href="class_c_socket.html#ad08fc2df680d1fd84035f5aada97dd3a">CSocket::SetService</a></div><div class="ttdeci">virtual void SetService(CBasicService *service)</div><div class="ttdoc">关联相应的工作类</div><div class="ttdef"><b>Definition:</b> <a href="_socket_8cpp_source.html#l00047">Socket.cpp:47</a></div></div>
<div class="ttc" id="aclass_c_udp_server_html_a57d65bbcd1d3593a1c82ac3765c67ca3"><div class="ttname"><a href="class_c_udp_server.html#a57d65bbcd1d3593a1c82ac3765c67ca3">CUdpServer::Post</a></div><div class="ttdeci">virtual void Post(const SharedPtr&lt; HandleBase &gt; &amp;func, void *invoker=NullPtr)</div><div class="ttdoc">投递一个中断请求</div><div class="ttdef"><b>Definition:</b> <a href="_udp_server_8cpp_source.html#l00063">UdpServer.cpp:63</a></div></div>
<div class="ttc" id="atools_8h_html_ac909db71799bb22cb7d636a34cd785e4"><div class="ttname"><a href="tools_8h.html#ac909db71799bb22cb7d636a34cd785e4">DEF_END_LIBTOOLS</a></div><div class="ttdeci">#define DEF_END_LIBTOOLS</div><div class="ttdef"><b>Definition:</b> <a href="tools_8h_source.html#l00038">tools.h:38</a></div></div>
<div class="ttc" id="aclass_c_stream_iteator_html_abd398f0c306bb0d8090328abdf29580a"><div class="ttname"><a href="class_c_stream_iteator.html#abd398f0c306bb0d8090328abdf29580a">CStreamIteator::cend</a></div><div class="ttdeci">virtual const char * cend() const</div><div class="ttdoc">返回序列结束位置</div><div class="ttdef"><b>Definition:</b> <a href="_stream_byte_8cpp_source.html#l00026">StreamByte.cpp:26</a></div></div>
<div class="ttc" id="astruct_o_v_e_r_l_a_p_p_e_d___e_x_html"><div class="ttname"><a href="struct_o_v_e_r_l_a_p_p_e_d___e_x.html">OVERLAPPED_EX</a></div><div class="ttdef"><b>Definition:</b> <a href="_sock_data_8h_source.html#l00063">SockData.h:63</a></div></div>
<div class="ttc" id="a_epoll_service_8h_html"><div class="ttname"><a href="_epoll_service_8h.html">EpollService.h</a></div></div>
<div class="ttc" id="aclass_c_sock_exception_html"><div class="ttname"><a href="class_c_sock_exception.html">CSockException</a></div><div class="ttdoc">sockeet操作异常类</div><div class="ttdef"><b>Definition:</b> <a href="_sock_exception_8h_source.html#l00012">SockException.h:12</a></div></div>
<div class="ttc" id="aclass_shared_ptr_html_a0b0a4c8396bf40f91994f729855c0a5a"><div class="ttname"><a href="class_shared_ptr.html#a0b0a4c8396bf40f91994f729855c0a5a">SharedPtr::Reset</a></div><div class="ttdeci">void Reset(Ty *p)</div><div class="ttdef"><b>Definition:</b> <a href="_shared_ptr_8h_source.html#l00175">SharedPtr.h:175</a></div></div>
<div class="ttc" id="aclass_c_udp_server_html_aeb69d95dd3123fd4f56d565a19fbec67"><div class="ttname"><a href="class_c_udp_server.html#aeb69d95dd3123fd4f56d565a19fbec67">CUdpServer::AsyncRecvfrom</a></div><div class="ttdeci">virtual void AsyncRecvfrom(CUdpSocket &amp;sock, const CStreamIteator &amp;buff, CSockAddr *addr, const SharedPtr&lt; HandleBase &gt; &amp;func, void *invoker=NullPtr)</div><div class="ttdoc">投递一个接收请求</div><div class="ttdef"><b>Definition:</b> <a href="_udp_server_8cpp_source.html#l00043">UdpServer.cpp:43</a></div></div>
<div class="ttc" id="aclass_c_io_port_service_html_a5ffa1d9379ae7595d2febd119f42a738"><div class="ttname"><a href="class_c_io_port_service.html#a5ffa1d9379ae7595d2febd119f42a738">CIoPortService::SetTimer</a></div><div class="ttdeci">virtual void SetTimer(TimerInfo &amp;tinfo)=0</div><div class="ttdoc">设置定时器</div></div>
<div class="ttc" id="anamespace_s_o_c_k_e_t_s_t_a_t_u_s_html_a960fa087f22eb32da3c7d0c805be7876acbc6a92d2f6de3cda399fb0de0ffdd98"><div class="ttname"><a href="namespace_s_o_c_k_e_t_s_t_a_t_u_s.html#a960fa087f22eb32da3c7d0c805be7876acbc6a92d2f6de3cda399fb0de0ffdd98">SOCKETSTATUS::POST</a></div><div class="ttdoc">用户请求</div><div class="ttdef"><b>Definition:</b> <a href="_socket_def_8h_source.html#l00105">SocketDef.h:105</a></div></div>
<div class="ttc" id="aclass_c_stream_iteator_html_a0099f615b4deffd3273c9c4d7cae4a91"><div class="ttname"><a href="class_c_stream_iteator.html#a0099f615b4deffd3273c9c4d7cae4a91">CStreamIteator::cbegin</a></div><div class="ttdeci">virtual const char * cbegin() const</div><div class="ttdoc">返回序列开始位置</div><div class="ttdef"><b>Definition:</b> <a href="_stream_byte_8cpp_source.html#l00021">StreamByte.cpp:21</a></div></div>
<div class="ttc" id="aclass_c_udp_server_html_a4287fe6a8d3a5fe821d4faf52fc68ebc"><div class="ttname"><a href="class_c_udp_server.html#a4287fe6a8d3a5fe821d4faf52fc68ebc">CUdpServer::IoCompleteFunc</a></div><div class="ttdeci">static DWORD IoCompleteFunc(OVERLAPPED_EX *oved)</div><div class="ttdef"><b>Definition:</b> <a href="_udp_server_8cpp_source.html#l00143">UdpServer.cpp:143</a></div></div>
<div class="ttc" id="atools_8h_html_a798af1e30bc65f319c1a246cecf59e39"><div class="ttname"><a href="tools_8h.html#a798af1e30bc65f319c1a246cecf59e39">DWORD</a></div><div class="ttdeci">unsigned int DWORD</div><div class="ttdef"><b>Definition:</b> <a href="tools_8h_source.html#l00134">tools.h:134</a></div></div>
<div class="ttc" id="aclass_c_io_port_service_html"><div class="ttname"><a href="class_c_io_port_service.html">CIoPortService</a></div><div class="ttdef"><b>Definition:</b> <a href="_io_port_service_8h_source.html#l00032">IoPortService.h:32</a></div></div>
<div class="ttc" id="aclass_c_udp_server_html_a1822fe02505a31d617e136515243a2a1"><div class="ttname"><a href="class_c_udp_server.html#a1822fe02505a31d617e136515243a2a1">CUdpServer::CUdpServer</a></div><div class="ttdeci">CUdpServer(bool isWriteLog)</div><div class="ttdef"><b>Definition:</b> <a href="_udp_server_8cpp_source.html#l00014">UdpServer.cpp:14</a></div></div>
<div class="ttc" id="aclass_c_io_port_service_html_a87b609526def283ffb20cc4b4c082473"><div class="ttname"><a href="class_c_io_port_service.html#a87b609526def283ffb20cc4b4c082473">CIoPortService::IsStop</a></div><div class="ttdeci">virtual bool IsStop() const =0</div><div class="ttdoc">服务是否停止</div></div>
<div class="ttc" id="aclass_c_udp_server_html_aed8baba7d9895b6895d9624ee8cb1bf4"><div class="ttname"><a href="class_c_udp_server.html#aed8baba7d9895b6895d9624ee8cb1bf4">CUdpServer::Run_One</a></div><div class="ttdeci">virtual bool Run_One()</div><div class="ttdoc">运行一次服务</div><div class="ttdef"><b>Definition:</b> <a href="_udp_server_8cpp_source.html#l00082">UdpServer.cpp:82</a></div></div>
<div class="ttc" id="aclass_c_udp_server_html_a094ecc90a9e5cd326a58928bf48ce08c"><div class="ttname"><a href="class_c_udp_server.html#a094ecc90a9e5cd326a58928bf48ce08c">CUdpServer::Run</a></div><div class="ttdeci">virtual bool Run()</div><div class="ttdoc">运行服务</div><div class="ttdef"><b>Definition:</b> <a href="_udp_server_8cpp_source.html#l00073">UdpServer.cpp:73</a></div></div>
<div class="ttc" id="aclass_c_udp_server_html_a2242ee6ccbb71fa768ba191c8a61f9a2"><div class="ttname"><a href="class_c_udp_server.html#a2242ee6ccbb71fa768ba191c8a61f9a2">CUdpServer::WaitServerStop</a></div><div class="ttdeci">virtual void WaitServerStop()</div><div class="ttdoc">通知服务停止并等待</div><div class="ttdef"><b>Definition:</b> <a href="_udp_server_8cpp_source.html#l00102">UdpServer.cpp:102</a></div></div>
<div class="ttc" id="aclass_c_udp_server_html_a7c2f7216c3241414dc4d76175240a42d"><div class="ttname"><a href="class_c_udp_server.html#a7c2f7216c3241414dc4d76175240a42d">CUdpServer::_service</a></div><div class="ttdeci">SharedPtr&lt; CIoPortService &gt; _service</div><div class="ttdef"><b>Definition:</b> <a href="_udp_server_8h_source.html#l00098">UdpServer.h:98</a></div></div>
<div class="ttc" id="aclass_c_io_port_service_html_a4e27edba8096659e67f2f275eeeba984"><div class="ttname"><a href="class_c_io_port_service.html#a4e27edba8096659e67f2f275eeeba984">CIoPortService::IsInit</a></div><div class="ttdeci">virtual bool IsInit() const =0</div></div>
<div class="ttc" id="astruct_o_v_e_r_l_a_p_p_e_d___e_x_html_a614e5742d57e4905fdf46b8727486b5e"><div class="ttname"><a href="struct_o_v_e_r_l_a_p_p_e_d___e_x.html#a614e5742d57e4905fdf46b8727486b5e">OVERLAPPED_EX::sockStatus</a></div><div class="ttdeci">DWORD sockStatus</div><div class="ttdoc">套接口的状态</div><div class="ttdef"><b>Definition:</b> <a href="_sock_data_8h_source.html#l00074">SockData.h:74</a></div></div>
<div class="ttc" id="aclass_c_io_port_service_html_afc1a07c4cf6e9aa6f2a00d157dfd9eed"><div class="ttname"><a href="class_c_io_port_service.html#afc1a07c4cf6e9aa6f2a00d157dfd9eed">CIoPortService::Init</a></div><div class="ttdeci">virtual CSockError Init(CSocket &amp;sock, bool isServer=false)=0</div></div>
<div class="ttc" id="aclass_c_io_port_service_html_a88ce9281be3952a469f8c3b6bf0f9d5b"><div class="ttname"><a href="class_c_io_port_service.html#a88ce9281be3952a469f8c3b6bf0f9d5b">CIoPortService::NotifyStop</a></div><div class="ttdeci">virtual void NotifyStop()=0</div><div class="ttdoc">通知停止服务</div></div>
<div class="ttc" id="aclass_c_udp_server_html_aeb3e2cc49ab20aeaf396c40e28f58627"><div class="ttname"><a href="class_c_udp_server.html#aeb3e2cc49ab20aeaf396c40e28f58627">CUdpServer::SetTimer</a></div><div class="ttdeci">virtual void SetTimer(CTimerBase &amp;timer)</div><div class="ttdef"><b>Definition:</b> <a href="_udp_server_8cpp_source.html#l00133">UdpServer.cpp:133</a></div></div>
<div class="ttc" id="astruct_o_v_e_r_l_a_p_p_e_d___e_x_html_a29eca265ddf9e8858e7360a27004866b"><div class="ttname"><a href="struct_o_v_e_r_l_a_p_p_e_d___e_x.html#a29eca265ddf9e8858e7360a27004866b">OVERLAPPED_EX::sockError</a></div><div class="ttdeci">CSockError sockError</div><div class="ttdoc">错误码</div><div class="ttdef"><b>Definition:</b> <a href="_sock_data_8h_source.html#l00075">SockData.h:75</a></div></div>
<div class="ttc" id="aclass_c_io_port_service_html_a2b82286514aa89ecd2a7470047c4845e"><div class="ttname"><a href="class_c_io_port_service.html#a2b82286514aa89ecd2a7470047c4845e">CIoPortService::Post</a></div><div class="ttdeci">virtual void Post(const SharedPtr&lt; HandleBase &gt; &amp;func, void *invoker=NullPtr)=0</div><div class="ttdoc">投递一个中断请求</div></div>
<div class="ttc" id="astruct___w_s_a_b_u_f_html_a018f049fe75c6f822a1765f16fdcb1f6"><div class="ttname"><a href="struct___w_s_a_b_u_f.html#a018f049fe75c6f822a1765f16fdcb1f6">_WSABUF::buf</a></div><div class="ttdeci">CHAR * buf</div><div class="ttdef"><b>Definition:</b> <a href="_sock_data_8h_source.html#l00022">SockData.h:22</a></div></div>
<div class="ttc" id="aclass_c_io_port_service_html_ae247b9ad53c577481a6a17713e6a0685"><div class="ttname"><a href="class_c_io_port_service.html#ae247b9ad53c577481a6a17713e6a0685">CIoPortService::Shutdown</a></div><div class="ttdeci">virtual int Shutdown()=0</div><div class="ttdoc">停止服务,该函数会等待所有的线程退出</div></div>
<div class="ttc" id="aclass_c_udp_base_html"><div class="ttname"><a href="class_c_udp_base.html">CUdpBase</a></div><div class="ttdef"><b>Definition:</b> <a href="_udp_base_8h_source.html#l00011">UdpBase.h:11</a></div></div>
<div class="ttc" id="anamespace_s_o_c_k_e_t_s_t_a_t_u_s_html_a960fa087f22eb32da3c7d0c805be7876a5a76b20cc3c857f53d6e5e7e817c8959"><div class="ttname"><a href="namespace_s_o_c_k_e_t_s_t_a_t_u_s.html#a960fa087f22eb32da3c7d0c805be7876a5a76b20cc3c857f53d6e5e7e817c8959">SOCKETSTATUS::UNINIT</a></div><div class="ttdoc">未初始化</div><div class="ttdef"><b>Definition:</b> <a href="_socket_def_8h_source.html#l00087">SocketDef.h:87</a></div></div>
<div class="ttc" id="aclass_c_udp_server_html_a926f304c91aa6e0d66e7fe7f3189f5e6"><div class="ttname"><a href="class_c_udp_server.html#a926f304c91aa6e0d66e7fe7f3189f5e6">CUdpServer::NotifyStop</a></div><div class="ttdeci">virtual void NotifyStop()</div><div class="ttdoc">通知服务停止</div><div class="ttdef"><b>Definition:</b> <a href="_udp_server_8cpp_source.html#l00091">UdpServer.cpp:91</a></div></div>
<div class="ttc" id="a_udp_server_8h_html"><div class="ttname"><a href="_udp_server_8h.html">UdpServer.h</a></div></div>
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者 &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.16
</small></address>
</body>
</html>
